package com.frejoys.service.huajuan;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.dao.entity.huajuan.HuajuanScore;

import java.util.List;

public interface HuajuanScoreService extends IService<HuajuanScore> {

    default HuajuanScore getOnly(QueryWrapper<HuajuanScore> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default HuajuanScore getOnly(LambdaQueryWrapper<HuajuanScore> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    /**
     * 增加积分记录
     * @param huajuanUserId 花卷云用户id
     * @param score
     * @return
     */
    boolean addIncrScoure(Integer huajuanUserId, Integer score);

    /**
     * 减少积分记录
     * @param huajuanUserId 花卷云用户id
     * @param score
     * @return
     */
    boolean addDecrScoure(Integer huajuanUserId, Integer score);

    // 执行积分更新
    boolean upScoure(Long msgSn, Integer status);

    // 获取待处理积分列表
    List<HuajuanScore> getWaitList(Integer page, Integer size);

    // 添加积分给花卷云用户
    boolean setUserScore(Long userId, Integer score, Integer type);

}
